<template>
	<view class="page">
		<view class="upper">
			<commonNavBar title="执法案例"  >
				<template v-slot:right>
					<text @tap="fillOut" class="right-text">智能填写</text>
				</template>
			</commonNavBar>    
		</view>
		<view class="title2" >
			<text class="title-text2">{{title}}</text>
		</view>
		<u-parse className="content" :content="content"  ></u-parse>
		<!-- <rich-text  class="content" :nodes="content"></rich-text> -->
		<!-- <view class="content" v-html="content"></view> -->
	</view>
</template>

<script>
	import uParse from '@/components/u-parse/u-parse.vue'
	import navBar from '@/components/CommonNavBar.vue'
	import commonNavBar from '@/components/CommonNavBar.vue';
	 
	export default {
		components:{
			commonNavBar,
			'nav-bar':navBar,
			'u-parse': uParse
		},
		data() {
			return {
				title:'',
				caseId:'',
				cfyj:'',
				cfnr:'',
				content:''
			}
		},
		onLoad() {
			
		},
		onReady () {
			const  that = this;
			 const eventChannel = this.getOpenerEventChannel(); 
			  eventChannel.on('documentContent', function(data) { 
				  console.log(data)
				that.title = data.title
				that.content = data.content
				that.caseId = data.caseId
				that.cfyj = data.cfyj
				that.cfnr = data.cfnr
			  })
		},
		methods: {
			goBack(){
				uni.navigateBack()
			},
			fillOut(){
				const that = this; 
				//填写内容
				uni.navigateBack({
					delta:2,
					success:function(res){
						const eventChannel = that.getOpenerEventChannel(); 
						eventChannel.emit("insertContent", {  
							caseId: that.caseId,
							cfyj : that.cfyj,
							cfnr : that.cfnr
						})
					}
				})
			}
		}
	}
</script>

<style  lang="scss">
	.page {
		background: #F9F9F9; 
		padding: 14px;
	}
	.title-text{
		color: #ffffff;
	}
	.upper {
		position: fixed;
		z-index: 1;
		top: 0;
		left: 0;
		width:  750rpx;
	
		.title {
			background: url('../../../static/img/inspectBg.png');
			background-size: cover;
			width: 750rpx;
			height: 115rpx;
			line-height: 115rpx;
			position: relative;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
	
			.arrow { 
				left: 33rpx; 
				transform: translate(0%, -50%);
				width: 100rpx;
				height: 100rpx;
	
				&::before {
					display: block;
					content: ""; 
					left: 0%;
					width: 20rpx;
					height: 20rpx;
					border-left: 1px solid #fff;
					border-top: 1px solid #fff;
					transform: translate(0%, -50%) rotate(-45deg);
				}
			}
	
			text {
				font-size: 30rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				letter-spacing: 1px;
			}
	
			.screen { 
				right: 10rpx;
				height: 115rpx;
				line-height: 115rpx;
				transform: translate(0%, -50%);
				width: 140rpx; 
			}
		}
	}
	.title2{
		margin-top: 90px;
	}
	.title-text2{
		color: #000;
		font-size: 20px;
		font-weight: 700;
		text-align: center;
	}
   .content{
	   padding: 14rpx;
		font-size: 26rpx;
   }
   .right-text{color: #fff;}
</style>
